#!/usr/bin/perl -w

open FILE, " <fred";
@array = <FILE>;

while (1) {
 eval {
 print "enter a pattern \n";
 chomp ($pat = <STDIN>);
  if ( $pat =~ /^\s*$/ ) {
  last;
  }
  foreach (@array) {
    if (/$pat/) {
    print "$_ \n"; 
    $count += 1;
    }
  }  
   print "pattern has found $count ones \n";
   $count = 0; 
 };
   if ($@) {
   print "an error occured $@ continuing \n";
   }
 
}


